<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="主题列表" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<script src="/js/QueryList.js"></script>
<script language="javascript">
	function doSearch(){
		var searchKey=encodeURIComponent(document.getElementById("search_key").value.trim());
		window.location="/bbs/BbsTopicList.ihtm?column_id=${column.id}&search_key="+searchKey;
	}
	function doNew(){
		window.location="/bbs/BbsArticleNew.ihtm?column_id=${column.id}";
	}
	function doGo(pageIndex){
		var searchKey=encodeURIComponent("${searchKey}");
		window.location="/bbs/BbsTopicList.ihtm?column_id=${column.id}&search_key="+searchKey+"&current_page="+pageIndex;
	}
	function doJump(pageIndex){
		if(window.event.keyCode==13){
			doGo(pageIndex);
		}
	}
	function doInit(){
		document.getElementById("search_key").focus();
	}
	function checkSearchKey(){
		if(window.event.keyCode==13){
			doSearch();
		}
	}
	function doMultiDelete(){
		var ob_arr = document.getElementsByName("query_checkbox");
		var str="";
		for (i=0;i<ob_arr.length;i++){
			if ((ob_arr[i].checked == true)){
				if(str!=""){
					str=str+";";
				}
				str = str+ob_arr[i].value;
			}
		}
		if(str==""){
			parent.ShowAlert('提示框','请选择要删除的公告!',200,100);
		}else{
			parent.ShowConfirm('确认框','确定删除吗？',340,80,"doDelTopic('"+str+"')");//doDelTopic是父窗口的
		}
	}
	function doDeleteAct(id){
		window.location="/bbs/BbsTopicDelete.ihtm?id="+id+"&from_url="+encodeURIComponent(window.location);
	}
</script>
</head>
<body onLoad="doInit();" scroll="no" style="background: #EAFAFF;">
	<div id="scrollDiv" style="OVERFLOW:auto;height:468px;">
		<div class="main search-business">
			   <div class="cue-info">
					<h4>
						${column.columnName}
					</h4>				   	
			  </div>
			  <div class="add_content">		
	        	<div align="right">								  		             	
						<input type="text" class="TextBox" id="search_key" name="search_key" onKeyUp="checkSearchKey();"  value="${searchKey}" title="以主题、发件人进行模糊查询">
						<input type="button" class="buttom  search-but" value=" 查 询 " onClick="doSearch();" title="以主题、发件人进行模糊查询">
						<c:if test="${currentUser.user.userType==1}"><input type="button" class="buttom search-remo" value=" 删 除" id="sDelButton" name="sDelButton" onclick="javascript:doMultiDelete();" /></c:if>
						<input type="button" class="buttom  search-add" value=" 发 表" onClick="doNew();" >
	        	</div>
        	  </div>			  
			  <%@include file="../inc/AlertMsg.jsp"%>

			  <div class="table-list" style="width:95%; padding:15px 0 15px 10px; float:left;">
				  <table width="100%">
				      <tr>
				      	<c:if test="${currentUser.user.userType==1}"><th width="14"><input type="checkbox" onClick="javascript:checkall(this);"></th></c:if>
				        <th width="36%">主题</th>
				        <th width="12%">作者</th>
				        <th width="18%">发表时间</th>
				        <th width="10%">回复/浏览</th>
						<th width="24%">最后回复</th>
				      </tr>
					  <c:forEach var="item" items="${qr.list}" varStatus="i">
				      <tr>
				      	<c:if test="${currentUser.user.userType==1}"><td><input type="checkbox" name='query_checkbox' value="${item.id}"></td></c:if>
				        <td>
							<a href="/bbs/BbsReplyList.ihtm?topic_id=${item.id}&column_id=${item.columnId}">${item.title}</a>
							<c:if test="${item.hasAttach=='Y'}"><img src="/images/a32.gif" border="0"></c:if>
						</td>
				        <td>${item.createrName}</td>
				        <td><fmt:formatDate value="${item.createTime}" pattern="yyyy-MM-dd HH:mm"/></td>
				        <td>${item.replyCount}/${item.viewCount}</td>
						<td class="ListTd">
							<c:if test="${item.replyCount>0}">
								${item.replierName} <fmt:formatDate value="${item.lastTime}" pattern="yyyy-MM-dd HH:mm"/>
							</c:if>
						</td>
				      </tr>
					  </c:forEach>
		        </table>
					  <%@include file="../inc/Pages.jsp"%>   
			  </div>
			</div>
		</div>
</div>

</body>
</html>